package com.canbot.u05.activity.agenda.dialog

import android.content.Context
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import com.canbot.u05.R
import com.canbot.u05.activity.presidemode.newcode.view.NHostBaseDialog
import kotlinx.android.synthetic.main.agenda_tip_msg_dialog.*

/**
 * @author yinxiaowei
 * @date 2019/5/31
 */
class TipMsgDialog(context: Context, tip: String) : NHostBaseDialog(context), View.OnClickListener {
    init {
        val view = LayoutInflater.from(this.context).inflate(R.layout.agenda_tip_msg_dialog, null)
        setContentView(view)
        bottomBtn.setOnClickListener(this)
        contentTip?.text = tip
    }

    override fun onClick(v: View) {
        if (v === bottomBtn) {
            dismiss()
            if (iDialogBtnLisenter != null) {
                iDialogBtnLisenter.onConfirm(null)
            }
        }
    }

    override fun setDialogWindowAttr() {
        setCanceledOnTouchOutside(true)
        val window = this.window
        val lp = window!!.attributes
        lp.gravity = Gravity.CENTER
        lp.width = this.context.resources.getDimension(R.dimen.px880).toInt()//宽高可设置具体大小
        lp.height = this.context.resources.getDimension(R.dimen.px500).toInt()
        this.window?.attributes = lp
    }
}
